package com.zaicheng.gateway.config;

import com.zaicheng.gateway.filter.CustpmGatewayFilter;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 张在成
 */
//@Configuration
public class GatewayRoutesConfiguration {
    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder locatorBuilder){
        return locatorBuilder.routes().route(r->
                r.path("/user/1")
                .uri("lb://user-service")
                .filter(new CustpmGatewayFilter())
                .id("user-service"))
                .build();
    }

}
